<?php
function calculateWeight($keyword_aray,$title,$resume){
	$weight=0;
	$multiplyFactorTitle = 2;
	$base = 1;
	$multiplyFactorResume = 1;
	$wordsInTitle = explode(" ",$title);
	$wordsInResume = explode(" ",$resume);
	foreach($keyword_aray as $kw){
		foreach($wordsInTitle as $word){
			$found_title = searchString($kw,$word);
			if ($found_title){
				$weight = $weight + ($base * $multiplyFactorTitle);
			}
		}

		foreach($wordsInResume as $word){
			$encontro_resume = searchString($kw,$word);
			if ($encontro_resume){
				$weight = $weight + ($base * $multiplyFactorResume);
			}
		}
	}
	return($weight);
}
?>